package com.sg.service.biz.component.nb;

import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.stereotype.Service;

import java.text.DateFormat;
import java.text.SimpleDateFormat;

/**
 * @author ： 手工接入方法
 * @version 1.0
 * @since 2022/5/28 15:32
 */
@Service
public class NbCycleType {
    /**
     * code:analyzeAndGenerateDate
     * name:M2生成自然日名称（特殊方法）
     * desc:undefined
     * gen by moon at 12/3/2022, 3:49:24 PM
     **/
    @Trace(operationName = "M2生成自然日名称（特殊方法）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    public GenerateNameNaturalDayComRespDto generateNameNaturalDayCom(GenerateNameNaturalDayComReqDto reqDto) {
        GenerateNameNaturalDayComRespDto retData = new GenerateNameNaturalDayComRespDto();

        DateFormat dateFormat1 = new SimpleDateFormat("yyyy年MM月dd日");
        DateFormat dateFormat2 = new SimpleDateFormat("yyyy.MM.dd");
        DateFormat dateFormat3 = new SimpleDateFormat("yyyy-MM-dd");
        String myDateStr = null;
        if (reqDto.getComNumField() == 1) {
            myDateStr = dateFormat1.format(reqDto.getComTimeField());
        } else if (reqDto.getComNumField() == 2) {
            myDateStr = dateFormat2.format(reqDto.getComTimeField());
        } else if (reqDto.getComNumField() == 3) {
            myDateStr = dateFormat3.format(reqDto.getComTimeField());
        }
        retData.setCustomField(myDateStr);
        return retData;
    }
    //手工接入方法
}
